import Vue from 'vue'
// 引入vue-router
import VueRouter from 'vue-router'
// 引入About组件
import About from '@/pages/About.vue'
import Home from '@/pages/Home.vue'
import News from '@/pages/News.vue'
import Message from '@/pages/Message.vue'

// 应用VueRouter插件
Vue.use(VueRouter)

// 创建并暴露一个路由器
export default new VueRouter({
  mode: 'history',
  // routes中配置着一组一组的路由规则
  routes: [
    {
      path: '/about',
      component: About
    },
    {
      path: '/home',
      component: Home,
      children:[
        {
          path:'news', //注意：此处不是/news，是news
          component:News
        },
        {
          path:'message',
          component:Message
        }
      ]
    }
  ]
})

